This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import io.flutter.app.FlutterApplication; | |
| import com.instabug.instabugflutter.InstabugFlutterPlugin; | |
| import java.util.ArrayList; | |
| public class CustomFlutterApplication extends FlutterApplication { | |
| @Override | |
| public void onCreate() { | |
| super.onCreate(); | |
| ArrayList<String> invocationEvents = new ArrayList<>(); | |
| invocationEvents.add(InstabugFlutterPlugin.INVOCATION_EVENT_SHAKE); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| strategy: | |
| matrix: | |
| device: | |
| - "pixel" | |
| - "pixel_xl" | |
| - "pixel_c" | |
| - "Nexus 6" | |
| fail-fast: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - name: run tests | |
| timeout-minutes: 30 | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| env: | |
| ANDROID_SIGN_PWD: ${{ secrets.ANDROID_SIGN_PWD }} | |
| SECRET_REPO: ${{ secrets.SECRET_REPO }} | |
| GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }} | |
| with: | |
| api-level: 29 | |
| profile: ${{ matrix.device }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jobs: | |
| android-integration-test: | |
| name: run integration test on Android emulator | |
| runs-on: macOS-latest | |
| steps: | |
| - uses: actions/checkout@v1 | |
| - uses: actions/setup-java@v1 | |
| with: | |
| java-version: '8.x' | |
| - uses: subosito/flutter-action@v1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// Steps for encoding the message | |
| Uint16List expandedMsg = expandMsg(msg2bytes(msg)); | |
| Uint16List paddedMsg = padMsg(getEncoderCapacity(img), expandedMsg); | |
| /// Helper function to convert string to bytes | |
| Uint16List msg2bytes(String msg) { | |
| return Uint16List.fromList(msg.codeUnits); | |
| } | |
| /// Helper function to expand byte messages to bit messages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// Steps to encode the entire byte messages into images | |
| for (int i = 0; i < getEncoderCapacity(img); ++i) { | |
| encodedImg[i] = encodeOnePixel(img[i], paddedMsg[i]); | |
| } | |
| /// Helper function to encode one bit of message into 8 pixels | |
| int encodeOnePixel(int pixel, int msg) { | |
| int lastBitMask = 254; | |
| int encoded = (pixel & lastBitMask) | msg; | |
| return encoded; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| crypto.Key key = crypto.Key.fromUtf8(padCryptionKey(token)); | |
| crypto.IV iv = crypto.IV.fromLength(16); | |
| crypto.Encrypter encrypter = crypto.Encrypter(crypto.AES(key)); | |
| crypto.Encrypted encrypted = encrypter.encrypt(msg, iv: iv); | |
| msg = encrypted.base64; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Uint16List extractBitsFromImg(Uint16List img) { | |
| Uint16List extracted = Uint16List(img.length); | |
| for (int i = 0; i < img.length; i++) { | |
| extracted[i] = extractLastBit(img[i]); | |
| } | |
| return extracted; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Uint16List bits2bytes(Uint16List bits) { | |
| int byteCnt = bits.length ~/ 8; | |
| Uint16List byteMsg = Uint16List(byteCnt); | |
| for (int i = 0; i < byteCnt; ++i) { | |
| Uint16List bitsOfByte = Uint16List.fromList(bits.getRange(i * 8, i * 8 + 8).toList()); | |
| int byte = assembleBits(bitsOfByte); | |
| byteMsg[i] = byte; | |
| } | |
| return byteMsg; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| crypto.Key key = crypto.Key.fromUtf8(padCryptionKey(token)); | |
| crypto.IV iv = crypto.IV.fromLength(16); | |
| crypto.Encrypter encrypter = crypto.Encrypter(crypto.AES(key)); | |
| crypto.Encrypted encryptedMsg = crypto.Encrypted.fromBase64(msg); | |
| msg = encrypter.decrypt(encryptedMsg, iv: iv); |